package yf.mall.vo.down;


import lombok.Data;
import java.util.Date;
import com.alibaba.excel.annotation.*;
import java.io.Serializable;



import yf.mall.entity.ArticleEntity;
import yf.mall.vo.ArticleVo;

                                    import yf.mall.enums.ArticleStatusEnum;
    import yf.mall.enums.ArticleTypeEnum;
    
/**
 * 文章实体
 * 表名 article
 *
 *
 *
 * @date Wed Aug 02 10:54:31 CST 2023
 */
@Data
public class ArticleDown implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

                        //新闻ID
            @ExcelProperty("新闻ID")
            private Long id;
        
                        //标题
            @ExcelProperty("标题")
            private String title;
        
                        //IMG-封面
            @ExcelProperty("IMG-封面")
            private String img;
        
                        //IMG-详情
            @ExcelProperty("IMG-详情")
            private String bigImg;
        
                        //作者名
            @ExcelProperty("作者名")
            private String author;
        
                        //内容
            @ExcelProperty("内容")
            private String body;
        
                        //阅读数量
            @ExcelProperty("阅读数量")
            private Long readCount;
        
                        //发表时间
            @ExcelProperty("发表时间")
            private Date date;
        
                        //ENUM-状态:"PUBLISH-发表","NEW-未发表"
            @ExcelIgnore
            private Integer status;
                        @ExcelProperty("状态")
            private String statusStr;
        
                        //ENUM-类型:"MAN-名人堂","COLLEGE-爆单学院","BRAND-品牌介绍","OTHER-其他"
            @ExcelIgnore
            private Integer type;
                        @ExcelProperty("类型")
            private String typeStr;
        
                        //排序
            @ExcelProperty("排序")
            private Integer sort;
        
    
    public ArticleDown() {

    }

    public ArticleDown(ArticleVo vo) {
        ArticleEntity entity = vo.getEntity();
                                    this.setId(entity.getId());
            
                                    this.setTitle(entity.getTitle());
            
                                    this.setImg(entity.getImg());
            
                                    this.setBigImg(entity.getBigImg());
            
                                    this.setAuthor(entity.getAuthor());
            
                                    this.setBody(entity.getBody());
            
                                    this.setReadCount(entity.getReadCount());
            
                                    this.setDate(entity.getDate());
            
                                    this.setStatus(entity.getStatus());
                if(entity.getStatus()!=null){
                    this.setStatusStr( ArticleStatusEnum.indexOf(entity.getStatus()));
                }
            
                                    this.setType(entity.getType());
                if(entity.getType()!=null){
                    this.setTypeStr( ArticleTypeEnum.indexOf(entity.getType()));
                }
            
                                    this.setSort(entity.getSort());
            
            }


}
